#include "../freebsd_simple_queue.h"

#include <stdio.h>
#include <stdlib.h>

struct student
{
  int id;
  SIMPLEQ_ENTRY(student) next;
};



int main()
{
  SIMPLEQ_HEAD(xoo, student) stu_head;
  SIMPLEQ_INIT(&stu_head);

  for (int i = 0; i < 5; i++)
  {
    struct student * stu = (struct student*)malloc(sizeof(struct student));
    stu->id = i;
    SIMPLEQ_ENTRY_INIT(stu, next);

    SIMPLEQ_INSERT_TAIL(&stu_head, stu, next);
  }

  struct student *iter;
  while (!SIMPLEQ_EMPTY(&stu_head))
    {
      iter = SIMPLEQ_FIRST(&stu_head);
      SIMPLEQ_REMOVE_HEAD(&stu_head, iter, next);
      printf("%d", iter->id);
    }
}
